package com.tertyshniy.portlet.model.dao;

import com.tertyshniy.portlet.model.domain.FakeData;

import java.util.TreeMap;

    /**
 * DAO class
 * @author Dimon
 *
 */

public class FakeDataDaoImpl {
        /**
         * Data will be stored in the TreeMap
         */
          private static TreeMap contactDB = new TreeMap();

    public FakeDataDaoImpl()
    {}
        /**
          * Creates FakeData object
          * @param id   id of the created FakeData object
          * @param name  name of the created FakeData object
          * @param num   some number for the new object
          * @return new FakeData object
          */
    public FakeData createFakeData(String id,String name,String num){
        FakeData fakeData=new FakeData();
        fakeData.setId(id);
        fakeData.setName(name);
        fakeData.setSomeNumber(num);
       contactDB.put(id, fakeData);
        return fakeData;
    }
                  /**
          * Finds FakeData object by ID
          * @param id   id of the created FakeData object
          * @return FakeData object with  necessary id
          */
    public FakeData findFakeData(String id){
        return (FakeData)contactDB.get(id);
    }
            /**
          * removes FakeData object by id
          * @param id     id of the removed FakeData object
          */
    public void removeFakeData(String id){
       contactDB.remove(id);

    }


}
